-- Decompiled with the Synapse X Luau decompiler.

local ServerOHOH = _G.ServerOHOH;
local M = ServerOHOH.class.new(script, ServerOHOH.files.BaseComponent());
function M.new(self)
	return M(self);
end;
function M.ctor(self, p3)
	M.super.ctor(self, p3);
end;
function M.dtor(self)
	M.super.dtor(self);
end;
local event_manager = ServerOHOH.event_manager;

-- 注册事件
function M.RegistEvent(self, msgId, fuc)

	event_manager:RegistHandle(msgId, function(player, ...)
		local compt = player:GetComponent(self);
		if compt then
			compt:AddProcess(fuc, ...);
			return;
		end;
		warn(player.main_inst.Name .. "don't have component named " .. self.class);
	end);
end;

function M.Fire(self, msgId, ...)
	if self.parent then
		event_manager:Fire(self.parent, msgId, ...);
	end;
end;

function M.FireEventToAll(self, msgId, ...)
	event_manager:FireAll(msgId, ...);
end;

local function_manager = ServerOHOH.function_manager;


function M.RegistFunction(self, fucId, fuc)
	function_manager:SetHandle(fucId, function(player, ...)
		local compt = player:GetComponent(self);
		if compt then
			return fuc(compt, ...);
		end;
		warn(player.main_inst.Name .. "don't have component named " .. self.class);
	end);
end;


function M.Invoke(self, fucId, ...)
	if not self.parent then
		return;
	end;
	return function_manager:Invoke(self.parent, fucId, ...);
end;


return M;
